package com.bw.lib_avcore;

/**
 * @author ytx
 * @date 2025-10-23 10:58
 * @description 配置类
 */
public class Config {
    public int minWidth; //最小宽度
    public int maxWidth;//最大宽度

    public int fps;//帧率

    public int bitRate; //码率

    public int iFrameInternal;//关键帧间隔

    public Config(Builder builder){
        this.minWidth = builder.minWidth;
        this.maxWidth = builder.maxWidth;
        this.fps = builder.fps;
        this.bitRate  = builder.bitRate;
        this.iFrameInternal = builder.iFrameInternal;
    }


    //构建者模式
    public static class Builder{
        public int minWidth = 640; //最小宽度
        public int maxWidth = 1280;//最大宽度

        public int fps = 30;//帧率
        public int bitRate = 700 * 1000; //码率


        private int iFrameInternal = 1;
        public Builder setMinWidth(int minWidth){
            this.minWidth = minWidth;
            return this;
        }
        public Builder setMaxWidth(int maxWidth){
            this.maxWidth = maxWidth;
            return this;
        }
        public Builder setFps(int fps){
            this.fps = fps;
            return this;
        }
        public Builder setBitRate(int bitRate){
            this.bitRate = bitRate;
            return this;
        }
        public Builder setIFrameInternal(int iFrameInternal){
            this.iFrameInternal = iFrameInternal;
            return this;
        }


        public Config build(){
            return new Config(this);
        }


    }
}
